//
//  MyUtil.m
//  宏定义专用_zhourui
//
//  Created by 周瑞 on 15/12/2.
//  Copyright © 2015年 周瑞. All rights reserved.
//

#import "MyUtil.h"

@implementation MyUtil

/*写在AppDelegate中，收到内存警告的时候*/
/*
 //发生内存警告的时候
 -(void)applicationDidReceiveMemoryWarning:(UIApplication *)application
 {
 //清楚内存中的图片
 //停止下载图片
 [[SDWebImageManager sharedManager] cancelAll];
 //移除下载到内存中的图片
 [[SDWebImageManager sharedManager].imageCache clearMemory];
 }
*/



+ (BOOL)isURL:(NSString *)string
{
    NSString *pattern = @"^(http|https)://.*?$(net|com|.com.cn|org|me|)";
    
    NSPredicate *urlPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", pattern];
    
    return [urlPredicate evaluateWithObject:string];
}


//返回日期yyyy-MM-dd的格式的日期
- (NSDate *)dateWithYMD
{
    NSDateFormatter *fmt = [[NSDateFormatter alloc] init];
    fmt.dateFormat = @"yyyy-MM-dd";
    NSString *selfStr = [fmt stringFromDate:self];
    return [fmt dateFromString:selfStr];
}


@end
